from training.msg import DataFrameRequest
from iop import BusinessService
import pandas as pd

class ReadDataFrameBS(BusinessService):
    
    def get_adapter_type():
        
        return "Ens.InboundAdapter"
    
    def on_init(self):
        if not hasattr(self, 'target'):
            # 设置传递目标
            self.target = 'MyIRIS.PyBPL'
    
    def on_process_input(self, message_input):
        csv_file = '/irisdev/app/misc/line_graph.csv'
        csv_data = pd.read_csv(csv_file,low_memory=True)
        msg = DataFrameRequest()
        msg.data = csv_data
        self.trace(csv_data.to_string())
        self.send_request_async(self.target,msg)
        
            